﻿using System;
using Pfz.Threading;

namespace Pfz.RemoteGaming.Internal
{
	internal sealed class _UnsafeThreadedAnimationFromAction:
		UnsafeThreadedAnimation
	{
		private IteratorAction _animation;

		public _UnsafeThreadedAnimationFromAction(IteratorAction animation)
		{
			if (animation == null)
				throw new ArgumentNullException("animation");

			_animation = animation;
		}

		protected override void OnAnimate()
		{
			_animation(base.YieldReturn);
		}
	}
}
